#!/bin/sh /etc/rc.common

START=65

USE_PROCD=1
PROG=/usr/sbin/h3ccloud
NAME=h3ccloud
CONFIG_FILE=/etc/config/h3ccloud
LOG_FILE=/tmp/log/h3ccloud.log

start_h3ccloud_instance()
{
	procd_open_instance
	procd_set_param command $PROG
	procd_set_param respawn
	procd_close_instance
}

service_triggers()
{
	procd_add_reload_trigger "h3ccloud"
}

start_service()
{
	config_load "${NAME}"
	config_foreach start_h3ccloud_instance h3ccloud
	service_start /usr/sbin/h3ccloud -B -d 6 -c "$CONFIG_FILE" -f "$LOG_FILE"
}

stop_service() 
{
	service_stop /usr/sbin/h3ccloud
}

reload_service()
{
	rc_procd start_service "$@"
	return 0
}

